package com.bci.pwtz.service;

import java.util.List;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;

import com.bci.pwtz.common.util.PaginationList;
import com.bci.pwtz.exception.PwtzDatabaseException;
import com.bci.pwtz.mysql.model.CompanyAction;
import com.bci.pwtz.mysql.model.CompanyRole;
import com.bci.pwtz.mysql.model.CompanyRoleAction;

/**
 * 栏目服务 <br/>
 * <p>Description:<br/>
 *    <p>TODO 详细描述
 *
 * <p>For Examples <br/>
 * <PRE>
 * </PRE>
 * <p>
 */
public interface CompanyRoleService
{
    /**
     * 
      * 根据用父级栏目ID获取栏目信息 <br/>
     * <p>Description: TODO(详细描述)
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-9-16-下午2:15:15<br/>
     * <p>
     * @param pid
     * @param pageSize
     * @param pageNo
     * @return
     * @throws PwtzDatabaseException   
     *
     */
    List<CompanyRole> findCompanyRoleByUserId(Long userId) throws PwtzDatabaseException;

    /**
     * 一句话描述 <br/>
     * <p>Description: TODO(详细描述) 
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-9-18-下午3:10:51<br/>
     * <p>
     * @param companyRole
     * @return
     * @throws PwtzDatabaseException   
     * 
     */
    int add(CompanyRole companyRole) throws PwtzDatabaseException;
    
    public List<CompanyRoleAction> selectByRoleId(Long roleId) throws PwtzDatabaseException;
    
    public PaginationList<CompanyRole> selectByCompanyIds(Long[] companyIds,int pageIndex,int pageSize) throws PwtzDatabaseException;

    /**
     * 一句话描述 <br/>
     * <p>Description: TODO(详细描述) 
     * <br/>
     * <p>Author: tonic<br/>
     * <p>Date: 2014-10-13-下午7:09:29<br/>
     * <p>
     * @param companyId
     * @return
     * @throws PwtzDatabaseException   
     * 
     */
    CompanyRole selectDefault(Long companyId) throws PwtzDatabaseException;
    
    Set<String> getUserActionCodes(long companyUserId,long companyId) throws PwtzDatabaseException;
    
    boolean checkIsCreator(long companyUserId,long companyId) throws PwtzDatabaseException;
    
    boolean checkHasAction(HttpServletRequest req,String actionCode);
    
    public List<CompanyAction> selectCompanyAction() throws PwtzDatabaseException;
    
    int addCompanyRole(String rolename, long companyId, long companyRoleId, String jurisdiction) throws PwtzDatabaseException;
    
    int delCompanyRole(long companyRoleId) throws PwtzDatabaseException;
    
    boolean checkHasActions(HttpServletRequest req,String actionCodes);
    
    boolean checkExistsCompanyRole(long companyId,long roleId) throws PwtzDatabaseException;
    
    public boolean checkExistsCompanyUserRole(long companyId,long roleId) throws PwtzDatabaseException;
    
    public long selectCompanyRoleId(long companyId) throws PwtzDatabaseException;
    
    public boolean checkExistsUserCompanyRef(long userid,long companyId) throws PwtzDatabaseException;
    
    public boolean checkExistsCompanyRoleAction(long companyRoleId,String actionCode) throws PwtzDatabaseException;
    
    public List<CompanyRole> selectRole(long companyid,String rolename)throws PwtzDatabaseException;
    
    public List<String> selectRoleAction(Long companyId,Long userId)throws PwtzDatabaseException;
    
    public List<CompanyRole> selectCurrentRole(Long companyId,Long userId)throws PwtzDatabaseException;
}
